Skip to content

fix(ai-skills): exclude non-speckit copilot agent markdown from skill…#1867

Open
darkglow-net wants to merge 5 commits intogithub:mainfrom
darkglow-net:fix/copilot-ai-skills-filter
Open

fix(ai-skills): exclude non-speckit copilot agent markdown from skill…#1867
darkglow-net wants to merge 5 commits intogithub:mainfrom
darkglow-net:fix/copilot-ai-skills-filter

Conversation

@darkglow-net
Copy link

Description

Fix issue #1858 - install_ai_skills creates spurious skills from non-speckit agent files when using --ai copilot --ai-skills

Fix: install_ai_skills() now filters copilot command templates to speckit.*.md - preventing user-authored agent files in agents from being incorrectly converted into skills.
Other agents are unaffected since their commands_subdir directories contain only speckit templates.

Test: Adds test_copilot_ignores_non_speckit_agents to verify that non-speckit markdown files (e.g. other-agent.agent.md) in the shared agents directory are excluded from skill generation.

Testing

  1. Create dummy agent in .github/agents/
  2. specify init --ai copilot --ai-skills --here
  3. Confirm no misattributed non-speckit skills created in .github/skills/
image

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

RCA and remediation developed with Github Copilot. Code review conducted with Opus 4.6.

@darkglow-net darkglow-net requested a review from mnriem as a code owner March 16, 2026 15:25
Copilot AI review requested due to automatic review settings March 16, 2026 15:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes #1858 by preventing install_ai_skills() from generating skills from non–spec-kit GitHub Copilot agent markdown files that may coexist in .github/agents/.

Changes:

  • Update install_ai_skills() to filter Copilot templates to speckit.*.md.
  • Update the all-agents skills installation test to respect commands_subdir and adjust Copilot’s template filename.
  • Add a new test ensuring non-speckit Copilot agent markdown files are ignored during skill generation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/specify_cli/__init__.py Adds Copilot-specific template globbing to avoid converting unrelated .md files into skills.
tests/test_ai_skills.py Updates fixture setup to follow commands_subdir and adds coverage for ignoring non-speckit Copilot agent files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1184 to +1187
if selected_ai == "copilot":
command_files = sorted(templates_dir.glob("speckit.*.md"))
else:
command_files = sorted(templates_dir.glob("*.md"))
Comment on lines +458 to +463
(agents_dir / "speckit.plan.md").write_text(
"---\ndescription: Generate implementation plan.\n---\n\n# Plan\n\nBody.\n"
)
(agents_dir / "other-agent.agent.md").write_text(
"---\ndescription: Some other agent\n---\n\n# Other\n\nBody.\n"
)
Copy link
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address Copilot feedback. If not applicable please explain why

Fix missing `.agent` filename suffix

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 17, 2026 00:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #1858 where install_ai_skills (for --ai copilot --ai-skills) incorrectly converts non–spec-kit Markdown files in .github/agents/ into generated skills.

Changes:

  • Filter Copilot command templates during skill installation to only include speckit.*.md files.
  • Update the “all agents” skills install test to respect commands_subdir and add a Copilot-specific regression test to ignore non-speckit agent Markdown.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/specify_cli/__init__.py Adds Copilot-only template glob filtering (speckit.*.md) during skill generation.
tests/test_ai_skills.py Updates multi-agent install test to use commands_subdir; adds regression test ensuring non-speckit Copilot agent Markdown doesn’t generate skills.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +436 to +437
# Copilot uses speckit.*.agent.md templates; other agents use plain names
fname = "speckit.specify.agent.md" if agent_key == "copilot" else "specify.md"
Comment on lines +458 to +463
(agents_dir / "speckit.plan.md").write_text(
"---\ndescription: Generate implementation plan.\n---\n\n# Plan\n\nBody.\n"
)
(agents_dir / "other-agent.agent.md").write_text(
"---\ndescription: Some other agent\n---\n\n# Other\n\nBody.\n"
)

command_files = sorted(templates_dir.glob("*.md"))
if selected_ai == "copilot":
command_files = sorted(templates_dir.glob("speckit.*.md"))
Copilot AI review requested due to automatic review settings March 17, 2026 01:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes issue #1858 where install_ai_skills incorrectly generated skills from user-authored (non–spec-kit) Copilot agent markdown files under .github/agents/.

Changes:

  • Filter Copilot skill generation inputs to speckit.*.md templates only.
  • Update the cross-agent skills installation test to respect each agent’s commands_subdir.
  • Add a regression test ensuring non-speckit.* Copilot agent markdown files are ignored.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/specify_cli/__init__.py Adds Copilot-specific glob filtering so only speckit.*.md templates in .github/agents/ are considered for skill generation.
tests/test_ai_skills.py Updates the parametrized test to use commands_subdir and adds a Copilot regression test for ignoring non-speckit agent markdown.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +436 to +438
# Copilot uses speckit.*.agent.md templates; other agents use plain names
fname = "speckit.specify.agent.md" if agent_key == "copilot" else "specify.md"
(cmds_dir / fname).write_text(
skills_dir = project_dir / ".github" / "skills"
assert skills_dir.exists()
skill_dirs = [d.name for d in skills_dir.iterdir() if d.is_dir()]
assert "speckit-plan" in skill_dirs
Comment on lines +1184 to +1187
if selected_ai == "copilot":
command_files = sorted(templates_dir.glob("speckit.*.md"))
else:
command_files = sorted(templates_dir.glob("*.md"))
fix(ai-skills): normalize Copilot .agent template names and align template fallback filtering
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants